package com.kawa.kemanage.service.impl;

import com.kawa.kemanage.mapper.IncomeMapper;
import com.kawa.kemanage.service.IncomeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: KAIyo
 * @Date: 2025/6/10 13:41
 * @Version: v1.0.0
 * @Description: TODO
 **/
@Service
public class IncomeServiceImpl implements IncomeService {

    private static final Logger log = LoggerFactory.getLogger(IncomeServiceImpl.class);
    @Autowired
    private IncomeMapper incomeMapper;


    /**
     * 获取当前年份的收入情况
     * @return
     */
    @Override
    public Integer getYearIncome() {
        Integer yearIncome = 0;
        try {
            yearIncome = incomeMapper.getYearIncome();
            return yearIncome;
        }catch (Exception e){
            log.error("获取年收入异常"+e.getMessage());
        }
        return yearIncome;
    }

    /**
     * 获取当月的收入情况
     * @return
     */
    @Override
    public Integer getMonthIncome() {
        Integer monthIncome = 0;
        try {
            monthIncome = incomeMapper.getMonthIncome();
            return monthIncome;
        }catch (Exception e){
            log.error("获取月收入异常" + e.getMessage());
        }
        return monthIncome;
    }
}
